

class GUI {

	public static INNER_COLOR: number = 8947848;

	public static TXT_RED: string;

	private static m_openLevel: number = 0;

	public static MAX_X: number = 640;

	public static MAX_Y: number = 480;

	private static m_fadeInProgress: boolean = false;

	public static TXT_ZONE_OCCUPIED: string;

	public static TXT_OF: string;

	// private static m_sharedLvl: SharedLevels = null;

	private static m_currScore: number = 0;

	public static TXT_GREEN: string;

	public static TXT_POWER: string;

	public static TXT_ZONE: string;

	public static TXT_DISABLE_AI: string;

	private static m_fadeEnabled: boolean = true;

	public static TXT_LATEST: string;

	public static TXT_WALL: string //= GamezheroDictionary.getTranslationByName("wall");

	public static TXT_AUTHOR: string;

	public static TXT_DELETE_WALL: string;

	private static BUTTON_GLOW: egret.GlowFilter;

	private static m_game: Game = null;

	public static TXT_MORE_GAMES: string;

	public static TXT_PURPLE: string;

	public static TXT_EDIT: string;

	public static TXT_EXTERMINATION: string;

	public static TXT_CLASS: string;

	public static URL_ORIGINAL_GAME: string;

	public static TXT_TOP_RATED: string; //= GamezheroDictionary.getTranslationByName("top-rated");

	public static TXT_INSTANT_AI: string;

	public static TXT_REPLAY: string;

	private static m_parent: egret.Sprite = null;

	public static TXT_NEUTRAL: string;

	public static TXT_LEVEL_URL: string;

	private static BG_COLOR: number = 1122850;

	public static TXT_SHARED_LEVELS: string;

	public static TXT_SUBMIT_LVL_Hnumber_ERROR: string;

	public static TXT_SUBMIT: string;

	public static OUTLINE_COLOR: number = 15658734;

	private static m_fadeAlpha: number = 1;

	public static TXT_MICROBE: string;// = GamezheroDictionary.getTranslationByName("microbe");

	// private static m_sharedObj: SharedObject = null;

	public static TXT_OPEN_URL: string;// = GamezheroDictionary.getTranslationByName("open-link");

	public static TXT_FINAL_SCREEN: string = "Created by Lumarama";

	public static TXT_MAX_POWER: string;

	public static TXT_QUICK_AI: string;

	public static TXT_COPY_TO_CLIPBOARD: string// = GamezheroDictionary.getTranslationByName("copy-clipboard");

	private static m_fade: egret.Sprite = null;

	public static TXT_SUBMIT_SCORE: string;

	public static TXT_PAGE: string;

	private static m_currLevel: number = 0;

	public static TXT_TEST: string;

	public static TXT_DELETE_MICROBE: string;

	public static TXT_BLACK: string;

	public static TXT_SHARED: string = "X";

	public static TXT_ERROR: string;

	public static TXT_LEVEL_URL_LONG1: string;

	public static TXT_LEVEL_URL_LONG2: string// = GamezheroDictionary.getTranslationByName("share-level-long-2");

	public static BOTTOM_Y: number = 480;

	public static TXT_CANCEL: string;

	public static TXT_GAME_Hnumber1: string;

	public static TXT_WALKTHROUGH: string;

	public static TXT_GAME_Hnumber3: string;

	public static TXT_NORMAL_AI: string;

	public static TXT_GAME_Hnumber2: string;

	private static ADD_THIS_X_DELTA: number = 0;

	public static TXT_TIME: string;

	public static TXT_TUTORIAL1: string;

	public static TXT_TUTORIAL2: string;

	private static m_items: Array<any>;

	public static TXT_SAVE_LEVEL: string;

	public static TXT_CREATE_MICROBE: string;

	private static BmpTitleBack;

	private static m_soundOn: boolean = true;

	public static TXT_CONTINUE: string;

	public static TXT_CREATE_WALL: string;

	public static TXT_PLAY: string;

	private static m_totalTries: number = 0;

	public static TXT_SCORE: string;

	private static m_fadeCompleteFunc: Function = null;

	public static TXT_LEVEL_NAME: string;

	private static m_successTries: number = 0;

	public static BACK_COLOR: number = 3355443;

	public static BmpBack;

	public static TXT_MENU: string;

	public static TXT_SELECT_LEVEL: string //= GamezheroDictionary.getTranslationByName("select-level");

	public static TXT_ORIGINAL_GAME: string = "Tentacle Wars 1".toLocaleUpperCase();

	// private static BmpSponsor;

	public static URL_SHARED_LEVEL: string = "http://www.gamezhero.com/online-games/strategy-games/tentaclewarsthepurplemenace-games.html?level_id=";

	public static TXT_SUBMIT_LVL_Hnumber_OK: string;


	public constructor() {
	}

	private static resultTop(isLevelPassed: boolean, time: number): egret.Sprite {
		var dialogX: number = 280;
		var dialog: egret.Sprite = new egret.Sprite();
		var g: egret.Graphics = dialog.graphics;
		this.removeAll();
		dialog.x = this.MAX_X / 2;
		dialog.y = this.MAX_Y / 2 - 30;
		g.beginFill(this.BG_COLOR, 1);
		g.lineStyle(1, 5592405);
		g.drawRect(-dialogX / 2, -300 / 2 + 30, dialogX, 300);
		g.endFill();
		var hdr: egret.Sprite = this.createText((!!isLevelPassed ? this.TXT_ZONE_OCCUPIED : this.TXT_EXTERMINATION).toUpperCase(), 30, !!isLevelPassed ? (5635925) : (16733525), 1, false, 16777215, "translate");
		hdr.x = 0;
		hdr.y = -80;
		dialog.addChild(hdr);
		var but: egret.Sprite = null;
		but = this.newButton(this.TXT_MENU, 0, 90, this.onGameMenu);
		dialog.addChild(but);
		// var btn: egret.DisplayObject = new BtnGamezhero();
		// btn.scaleX = 0.8;
		// btn.scaleY = 0.8;
		// btn.x = -(btn.width / 2) - 10;
		// btn.y = -(btn.height / 2) + 25;
		// btn.addEventListener(MouseEvent.CLICK, gameHeroClick);
		// dialog.addChild(btn);
		return dialog;
	}

	private static begnumberoGame(): void {
		if (this.m_currLevel >= 0) {
			if (this.m_game) {
				this.removeAll();
				this.m_game.initLevel(this.m_currLevel);
				// §§push(true);
			}
		}
		this.fade(false);
	}

	private static onSelectLevelClick(evt: egret.TouchEvent): void {
		var but: egret.Sprite = null;
		// §§push(true);
		if (this.m_game && evt.target instanceof egret.Sprite) {
			but = evt.target as egret.Sprite;
			this.m_currLevel = parseInt(but.name);
			if (this.m_currLevel >= 0) {
				// SoundMgr.playSfx(SoundMgr.BEGIN_GAME);
				this.fade(true, this.begnumberoGame);
			}
		}
	}

	public static createText(str: string, size: number, color: number, alpha: number = 1, outline: boolean = false, outlineColor: number = 16777215, fontName: string = "default", isCentered: boolean = true) {
		// return new TextSprite(str, size, color, alpha, outline, outlineColor, fontName, isCentered);
		 
		return new egret.Sprite();
	}

	private static onSubmitScoreClick(evt: MouseEvent = null): void {
		// Preloader.sendScore(0, m_currScore);
	}

	public static showInGamePanel(levelName: string, maxPower: number, time: number, testLevel: boolean = false): void {
		this.removeByName("ingame-panel");
		var dialog: egret.Sprite = new egret.Sprite();
		// var but = newButton(this.TXT_WALKTHROUGH, this.MAX_X - 70,this. MAX_Y - 15, this.gameHeroClick);
		// but.name = GameAllianzApiLinks.TO_GAME_WALKTHROUGH;
		// but.x = MAX_X - but.width / 2 - 10;
		// dialog.addChild(but);
		// m_parent.addChild(dialog);
		// m_items.push(dialog);
	}

	private static onMenuOrClear(): void {
		this.onGameMenu();
	}

	public static onStartSharedLevel(levelData: string, levelId: string, levelName: string, hnumber: string): void {
		// SoundMgr.playSfx(SoundMgr.BEGIN_GAME);
		this.fade(true, function (): void {
			this.removeAll();
			this.m_game.initSharedLevel(levelData, levelName, levelId);
			this.showInGameStatus(hnumber);
			this.fade(false);
		});
	}

	private static fade(enable: boolean, completeFunc: Function = null): void {
		if (!this.m_fadeInProgress) {
			this.m_fade.addEventListener(egret.Event.ENTER_FRAME, GUI.onEnterFrame, this);
		}
		this.m_fadeEnabled = enable;
		this.m_fadeInProgress = true;
		this.m_fadeCompleteFunc = completeFunc;
	}

	private static onGotoNameUrl(event: MouseEvent): void {
		// var but: DisplayObject = event.target as DisplayObject;
		// if (but != null && but.name.length > 0) {
		// 	trace(but.name);
		// 	gotoUrl(but.name);
		// }
	}

	public static removeAll(): void {
		// for (this.m_sharedLvl.hideLevelsChooser(); §§pop().length > 0; )
		// {
		// 	§§push(m_items);
		// 	§§push(true);
		// }
	}

	private static onFaseReplayLevel(evt: MouseEvent): void {
		this.fade(true, this.replayLevel);
	}

	private static onEnterFrame(event: Event): void {
		var done: boolean = false;
		done = true;
		this.m_fade.alpha = this.m_fadeAlpha;
		// §§push(m_fadeInProgress);
		if (done) {
			this.m_fade.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
			this.m_fadeInProgress = false;
			if (this.m_fadeCompleteFunc != null) {
				this.m_fadeCompleteFunc();
			}
		}
	}

	public static createnumbererSharedLevelMenu(levelId: string, isLevelPassed: boolean, time: number): void {
		// SoundMgr.playSfx(!!isLevelPassed ? number(SoundMgr.LEVEL_PASSED) : number(SoundMgr.LEVEL_FAILED));
		// GameAllianzApi.rateLevel();
	}

	public static createSharedLevelsMenu(): void {
		this.removeAll();
		this.fade(false);
		// var dialog: Sprite = mainBackBtns();
		// m_sharedLvl.showLevelsChooser();
		// m_parent.addChild(dialog);
		// m_items.push(dialog);
	}

	public static createFinalScreen(): void {
		this.removeAll();
		this.m_game.clearLevel();
		this.fade(true);
		// var logo: Sprite = new Sprite();
		//  /*UnknownSlot*/.addChild(bmp);
		// logo.scaleX = 0.7;
		// logo.scaleY = 0.7;
		// var but: Sprite = null;
		// but = newButton(TXT_SUBMIT_SCORE, MAX_X / 2, MAX_Y - 80, function (evt: MouseEvent): void {
		// 	if (m_soundOn) {
		// 		SoundMgr.musicEnable(true);
		// 	}
		// 	onSubmitScoreClick(evt);
		// });
		// this.m_fade.addChild(but);
		// this.m_items.push(but);
		// this.m_fade.addChild(but);
		// this.m_items.push(but);
	}

	public static hideHnumber(): void {
		this.removeByName("hnumber");
	}

	private static logoSprMouseOver(evt: MouseEvent): void {
		// var but: Sprite = evt.target as Sprite;
		// switch (evt.type) {
		// 	case MouseEvent.ROLL_OVER:
		// 		but.filters = [BUTTON_GLOW];
		// 		break;
		// 	case MouseEvent.ROLL_OUT:
		// 		but.filters = [];
		// }
	}

	public static createInfoPopup(x: Number, y: Number, str: string, name: string = "info-popup", isCentered: boolean = true, fontSize: number = 12): void {
		// var text: TextSprite = createText(str.toUpperCase(), fontSize, 11184810, 1, false, 16777215, "translate", isCentered);
		// text.x = x;
		// var g: Graphics = text.graphics;
		// var begx: Number = -3;
		// var begy: Number = 0;
		// §§push(true);
		// if (isCentered) {
		// 	begx = -(text.width + 6) / 2;
		// 	begy = -text.height / 2;
		// }
		// var sizex: Number = text.width + 10;
		// var sizey: Number = text.height;
		// g.beginFill(BG_COLOR, 0.9);
		// g.lineStyle(1, 5592405);
		// g.lineTo(begx, begy + sizey);
		// g.lineTo(begx + sizex - 8, begy + sizey);
		// g.lineTo(begx + sizex, begy + sizey - 8);
		// g.lineTo(begx + sizex, begy);
		// g.lineTo(begx, begy);
		// g.endFill();
		// m_parent.addChild(text);
		// m_items.push(text);
	}

	private static onSoundClick(event: MouseEvent): void {
		this.m_soundOn = !this.m_soundOn;
		// SoundMgr.musicEnable(m_soundOn);
		// SoundMgr.sfxEnable(m_soundOn);
		// var but: MovieClip = event.target as MovieClip;
	}

	public static init(game: Game, parent: egret.Sprite): void {
		// Style.setStyle(Style.CUSTOM);
		// m_game = game;
		// m_parent = new Sprite();
		// m_fade = new Sprite();
		// m_fade.mouseChildren = true;
		// m_fade.mouseEnabled = false;
		// m_fade.alpha = m_fadeAlpha;
		// m_sharedLvl = new SharedLevels(m_game, onStartSharedLevel, function (): void {
		// 	createLevelsMenu();
		// });
		// var g: Graphics = m_fade.graphics;
		// g.beginFill(0);
		// g.drawRect(0, 0, MAX_X, BOTTOM_Y);
		// g.endFill();
		// parent.addChild(m_parent);
		// parent.addChild(m_sharedLvl);
		// parent.addChild(m_fade);
		// m_sharedObj = SharedObject.getLocal("lumarama.tentacle_wars_purple_menace");
		// if (m_sharedObj.data.levelsOpened == null) {
		// 	m_openLevel = 1;
		// 	m_sharedObj.data.levelsOpened = m_openLevel;
		// 	m_sharedObj.flush(256);
		// }
		// else {
		// 	m_openLevel = m_sharedObj.data.levelsOpened;
		// 	if (m_openLevel > 1) {
		// 		KongAPI.submitLevel(m_openLevel - 1);
		// 		Preloader.unlockMedal(m_openLevel - 2);
		// 	}
		// }
		// fade(false);
	}

	private static gotoUrl(url: string): void {
		// try {
		// 	navigateToURL(new URLRequest(url), "_blank");
		// 	return;
		// }
		// catch (e: Error) {
		// 	trace(e.message);
		// 	return;
		// }
	}

	public static showHnumber(x: Number, y: Number, str: string, isCentered: boolean = false): void {
		// var text: TextSprite = createText(str, 12, 11184810, 1, false, 16777215, "translate", isCentered);
		// text.x = x;
		// text.y = y;
		// text.name = "hnumber";
		// this.m_items.push(text);
	}

	public static showInGameStatus(str: string, color: number = 15658666): void {
		// var text: Sprite = null;
		// removeByName("ingame-status");
		// if (str != null && str.length > 0) {
		// 	text = new "> ".TypingText(true, 11, color);
		// 	text.x = 190 + text.width / 2;
		// 	text.y = 15;
		// 	text.name = "ingame-status";
		// 	m_parent.addChild(text);
		// 	m_items.push(text);
		// 	§§push();
		// }
	}

	public static removeByName(name: string): void {
		// var item: Sprite = null;
		// for (var i: number = 0; i < m_items.length;) {
		// 	item = m_items[i];
		// 	if (item.name == name) {
		// 		item.parent.removeChild(item);
		// 		destoryItem(item);
		// 		item = null;
		// 		m_items.splice(i, 1);
		// 		if (i > 0) {
		// 			i--;
		// 		}
		// 	}
		// 	i++;
		// }
	}

	private static gameBottomBtns(dialog: egret.Sprite, isEditor: boolean): void {
		var g: egret.Graphics = dialog.graphics;
		// g.beginFill(0, 0.5);
		// g.drawRect(0, BOTTOM_Y - 30, MAX_X, 30);
		// g.endFill();
		// var but: DisplayObject = null;
		// if (!isEditor) {
		// 	but = new BtnRestart();
		// 	but.scaleX = 0.7;
		// 	but.scaleY = 0.7;
		// 	but.x = 110;
		// 	but.y = BOTTOM_Y - 15;
		// 	but.addEventListener(MouseEvent.CLICK, onFaseReplayLevel);
		// 	dialog.addChild(but);
		// 	but = new BtnPause();
		// 	but.scaleX = 0.7;
		// 	but.scaleY = 0.7;
		// 	but.x = 80;
		// 	but.y = BOTTOM_Y - 15;
		// 	but.addEventListener(MouseEvent.CLICK, onPauseClick);
		// 	dialog.addChild(but);
		// 	§§push(true);
		// }
		// var clp: MovieClip = new BtnSound();
		// clp.scaleX = 0.7;
		// clp.scaleY = 0.7;
		// clp.x = 50;
		// clp.y = BOTTOM_Y - 15;
		// clp.gotoAndStop(!!m_soundOn ? 2 : 1);
		// clp.addEventListener(MouseEvent.CLICK, onSoundClick);
		// clp.buttonMode = true;
		// dialog.addChild(clp);
		// but = new BtnExit();
		// but.scaleX = 0.7;
		// but.scaleY = 0.7;
		// but.x = 20;
		// but.y = BOTTOM_Y - 15;
		// but.addEventListener(MouseEvent.CLICK, onGameMenu);
		// dialog.addChild(but);
		// var btn: Sprite = newButton(TXT_MORE_GAMES, MAX_X / 2, BOTTOM_Y - 15, gameHeroClick);
	}

	public static createSaveDialog(levelData: string): void {
		// if (levelData != null) {
		// 	true.submitLevel(levelData, "", "", "", function (): void {
		// 		createLevelsMenu();
		// 	});
		// 	return;
		// 	§§push(m_sharedLvl);
		// }
		// else {
		// 	var win: Window = new Window(m_parent, 0, 0, levelData != null ? TXT_SAVE_LEVEL : TXT_ERROR);
		// 	win.draggable = false;
		// 	win.width = 250;
		// 	new hbox.PushButton(5, 0, TXT_CANCEL, true, function (e: MouseEvent): void {
		// 		removeByName("save-dialog");
		// 		if (levelData != null) {
		// 			m_game.initLevelEditor();
		// 		}
		// 	});
		// 	hbox.x = win.width / 2 - hbox.width / 2;
		// 	win.x = GUI.MAX_X / 2 - win.width / 2;
		// 	win.y = GUI.MAX_Y / 2 - win.height / 2;
		// 	return;
		// 	§§push(true);
		// 	§§push();
		// 	§§push(true);
		// }
	}

	public static showEditorPanel(): void {
		//  /*UnknownSlot*/.x = 0;
		// dialog.y = 0;
		// dialog.name = "ingame-panel";
		// gameBottomBtns(dialog, true);
		// var but: DisplayObject = null;
		// but = newButton(TXT_TEST, 0, MAX_Y - 15, function (e: MouseEvent): void {
		// 	m_game.testEditorLevel();
		// });
		// but.x = MAX_X - but.width / 2 - 10;
		// dialog.addChild(but);
		// m_parent.addChild(dialog);
		// m_items.push(dialog);
	}

	private static newButton(str: string, x: Number, y: Number, onClick: Function, fontSize: number = 14, fontName: string = "translate"): egret.Sprite {
		// var but: Sprite = createText(str, fontSize, 16777215, 1, false, 16777215, fontName);
		// but.x = x;
		// but.y = y;
		// return but;
		return;
	}

	private static continueNextGame(evt: MouseEvent): void {
		this.m_currLevel++;
		// SoundMgr.playSfx(SoundMgr.BEGIN_GAME);
		this.fade(true, this.begnumberoGame);
	}

	private static onGameMenu(evt: MouseEvent = null): void {
		// §§push(false);
		if (this.m_game) {
			this.m_game.clearLevel();
			// §§push(false);
		}
		else {
			this.fade(true, this.createLevelsMenu);
		}
	}

	private static onRemovePause(e: MouseEvent = null): void {
		// for (var spr: DisplayObject = null; m_fade.numChildren > 0;) {
		// 	spr = m_fade.getChildAt(0);
		// 	spr.parent.removeChild(spr);
		// }
		// this.m_fade.alpha = 0;
		// m_fade.mouseEnabled = false;
		// this.m_fade.removeEventListener(MouseEvent.CLICK, onRemovePause);
		// this.m_game.pause(false);
		// this.SoundMgr.musicEnable(m_soundOn);
	}

	public static createLevelsMenu(): void {
		// var ang: Number = NaN;
		// var open: boolean = false;
		// var r2: Number = NaN;
		// var g2: Graphics = null;
		// var color: unumber = 0;
		// var tendril: Tendril = null;

		// removeAll();
		// fade(false);
		// var dialog: Sprite = mainBackBtns();
		// var top: Sprite = new Sprite();
		// dialog.addChild(top);
		// var g: Graphics = top.graphics;


		// var r: Number = 80;
		// var levelsNum: number = 20;

		// var step: Number = Math.PI * 2 / levelsNum;

		// var x: Number = MAX_X / 2;

		// var /*UnknownSlot*/:* = true;
		// §§push(true);
		// §§push(createLevelsMenu$0);
		// if (i >= levelsNum) {
		// 	§§push(createLevelsMenu$0);
		// }
		// else {
		// 	ang = i * step - Math.PI / 2;
		// 	open = i < m_openLevel;
		// 	r2 = !!open ? Number(r + 50) : Number(r + 25);

		// 	g.moveTo(Math.cos(ang) * r + x, Math.sin(ang) * r + y);

		// 	g.lineTo(Math.cos(ang) * r2 + x, Math.sin(ang) * r2 + y);

		// 	var but: Sprite = newButton(string(i + 1), Math.cos(ang) * (r2 + 15) + x, Math.sin(ang) * (r2 + 15) + y, onSelectLevelClick, 18, "default");

		// 	but.name = !!open ? string(i) : string(-1);
		// 	g2 = but.graphics;
		// 	color = unumber(unumber(3385907));
		// 	§§push(createLevelsMenu$0);
		// 	if (i + 1 == m_openLevel) {
		// 		color = 8947848;
		// 	}
		// 	g2.beginFill(color, 0.5);
		// 	g2.drawCircle(0, 0, 15);
		// 	g2.endFill();
		// 	§§push(createLevelsMenu$0);
		// 	§§push(true);
		// }
		// but = newButton(TXT_EDIT, MAX_X / 2, MAX_Y / 2 - 30, function (e: MouseEvent): void {
		// 	m_game.initLevelEditor();
		// });
		// dialog.addChild(but);
		// but = newButton(TXT_SHARED_LEVELS, MAX_X / 2, MAX_Y / 2, function (e: MouseEvent): void {
		// 	gotoUrl("http://www.gamezhero.com/games/tentaclewarsthepurplemenace/levels");
		// });
		// dialog.addChild(but);
		// but = newButton(TXT_ORIGINAL_GAME, MAX_X / 2, MAX_Y / 2 + 30, function (e: MouseEvent): void {
		// 	GameAllianzApi.getUrl("http://www.gamezhero.com/games/tentaclewars", "_blank", "tentaclewars");
		// });
		// dialog.addChild(but);
		// m_parent.addChild(dialog);
		// m_items.push(dialog);
	}

	private static mainBackBtns(): egret.Sprite {
		// var clp: MovieClip = null;
		// var dialog: Sprite = new Sprite();
		// dialog.x = 0;
		// dialog.y = 0;
		// dialog.name = "main-menu";
		// var back: Bitmap = new BmpTitleBack();
		// dialog.addChild(back);
		// var logo: Bitmap = new BmpSponsor();
		// logo.smoothing = true;
		// var logoSpr: Sprite = new Sprite();
		// logoSpr.graphics.beginFill(1, 1);
		// logoSpr.graphics.drawRect(0, 0, logo.width, logo.height);
		// logoSpr.x = 10;
		// logoSpr.y = 10;
		// logoSpr.scaleX = 0.7;
		// logoSpr.scaleY = 0.7;
		// logoSpr.name = "http://lumarama.com/blog";
		// logoSpr.buttonMode = true;
		// logoSpr.addEventListener(MouseEvent.ROLL_OVER, logoSprMouseOver);
		// dialog.addChild(logoSpr);
		// var hdr: Sprite = createText("Tentacle Wars", 50, 16777215, 1, true, 0, "header");
		// hdr.x = MAX_X / 2;
		// hdr.y = 45;
		// hdr = createText("Lumarama\'s", 14, 16777215, 1, true, 0, "header");
		// hdr.x = MAX_X / 2 - 153;
		// hdr.y = 15;
		// dialog.addChild(hdr);
		// hdr = createText("The Purple Menace", 14, 11171788, 1, true, 0, "header");
		// hdr.x = MAX_X / 2 + 123;
		// hdr.y = 15;
		// dialog.addChild(hdr);
		// var btn1: Sprite = new AssetPortalLogo(dialog, MAX_X / 2 - 90, BOTTOM_Y - 70, 0.6);
		// var btn2: Sprite = new AssetFacebookButton(dialog, MAX_X - 60, BOTTOM_Y - 60, 0.5);
		// var btn3: Sprite = new AssetTwitterButton(dialog, 20, BOTTOM_Y - 60, 0.5);
		// clp = new BtnSound();
		// clp.x = MAX_X - 30;
		// clp.y = 30;
		// clp.gotoAndStop(!!m_soundOn ? 2 : 1);
		// clp.addEventListener(MouseEvent.CLICK, onSoundClick);
		// clp.buttonMode = true;
		// dialog.addChild(clp);
		// return dialog;
		return
	}
	//结算
	public static createnumbererLevelMenu(isLevelPassed: boolean, time: number, achieve: Achievements): void {
		// 	m_currScore = achieve.getScore();
		// 	//是否通关
		// 	if (isLevelPassed) {
		// 		KongAPI.submitHighScore(m_currScore);
		// 		Preloader.sendTemporaryScore(0, m_currScore);
		// 		Preloader.unlockMedal(m_openLevel - 2);
		// 		§§push(true);
		// 		if (m_currLevel + 2 > 20) {
		// 			createFinalScreen();
		// 			return;
		// 		}
		// 	}
		// 	else if (m_currLevel + 1 == m_openLevel) {
		// 		m_totalTries++;
		// 	}
		// 	true;
		// 	§§push(m_currLevel == 5);
		// 	if (time <= 40) {
		// 		m_game.newAchievement(Achievements.ID_FAST_VICTORY);
		// 	}
		// 	if (m_successTries >= 10 && m_totalTries <= m_successTries * 2) {
		// 		m_game.newAchievement(Achievements.ID_MIN_FAILS);
		// 		§§push(true);
		// 	}
		// 	else {
		// 		SoundMgr.playSfx(!!isLevelPassed ? number(SoundMgr.LEVEL_PASSED) : number(SoundMgr.LEVEL_FAILED));
		// 	}
		// 	var dialog: Sprite = resultTop(isLevelPassed, time);
		// 	dialog.name = "numberer-level";
		// 	var but: Sprite = null;
		// 	var timeSpr: Sprite = createText(true.toUpperCase(), 14, 15658666, 1, false, 16777215, "translate", true);
		// 	timeSpr.x = 0;
		// 	timeSpr.y = -45;
		// 	dialog.addChild(timeSpr);
		// 	§§push(TXT_TIME);
		// 	if (isLevelPassed) {
		// 		but = newButton(TXT_SUBMIT_SCORE, 0, -25, onSubmitScoreClick);
		// 		§§push(true);
		// 	}
		// 	if (isLevelPassed) {
		// 		but = newButton(TXT_MORE_GAMES, 0, 120, gameHeroClick);
		// 		but.name = GameAllianzApiLinks.TO_PORTAL_BY_MORE_GAMES;
		// 	}
		// 	else {
		// 		but = newButton(TXT_WALKTHROUGH, 0, 120, gameHeroClick);
		// 		but.name = GameAllianzApiLinks.TO_GAME_WALKTHROUGH;
		// 	}
		// 	dialog.addChild(but);
		// 	if (isLevelPassed) {
		// 		but = newButton(TXT_CONTINUE, 0, 150, continueNextGame);
		// 	}
		// 	else {
		// 		but = newButton(TXT_REPLAY, 0, 150, onFaseReplayLevel);
		// 	}
		// 	dialog.addChild(but);
		// 	m_parent.addChild(dialog);
		// 	m_items.push(dialog);
	}

	private static onPauseClick(e: MouseEvent = null): void {
		// m_fade.alpha = 0.7;
		// m_fade.mouseEnabled = true;
		// m_fade.addEventListener(MouseEvent.CLICK, onRemovePause);
		// m_game.pause(true);
		// SoundMgr.musicEnable(false);
		// var pause: Sprite = createText("PAUSED", 50, 16777215, 1, true, 0, "header");
		// pause.x = MAX_X / 2;
		// pause.y = MAX_Y / 2;
		// pause.mouseEnabled = false;
	}

	private static destoryItem(item: egret.Sprite): void {
		// var tendril: Tendril = null;
		// var text: TypingText = null;
		// var cell: Cell = null;
		// if (item is Tendril) {
		// 	tendril = item as Tendril;
		// 	tendril.destruct();
		// 	tendril = null;
		// }
		//  else if (item is TypingText) {
		// 	text = item as TypingText;
		// 	text.destruct();
		// 	text = null;
		// 	§§push(true);
		// }
		//  else if (item is Cell) {
		// 	cell = item as Cell;
		// 	cell.destruct();
		// 	cell = null;
		// 	§§push(true);
		// }
	}

	public static startSharedLevelById(levelId: string): void {
		// this.m_sharedLvl.getLevel(levelId, "");
	}

	private static replayLevel(): void {
		if (this.m_currLevel >= 0) {
			if (this.m_game) {
				this.removeAll();
				this.m_game.replayLevel();
			}
		}
		this.fade(false);
	}

	private static gameHeroClick(event: MouseEvent): void {
		// var but: DisplayObject = event.target as DisplayObject;
		// if (but != null && but.name.length > 0) {
		// 	GameAllianzApi.navigateTo(but.name);
		// }
	}
}
